package com.wyt.design.designmodel.observer;

import java.util.Observable;

/**
 * @author weiyatong
 * @version 1.0
 * @date 2021/6/27 下午6:43
 * @describe 观察者模式，主题
 */
public class Home extends Observable {
    private double price;

    public Home(double price) {
        this.price = price;
    }

    public double getPrice() {
        return this.price;
    }

    public void setPrice(double price) {
        if (this.price != price) {
            setChanged();  //更改状态
            notifyObservers(price);  //通知观察者
        }
    }

}
